﻿<!DOCTYPE html>
<html lang="@CurrentLanguageCode">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>@Title - NetCoreCMS Admin</title>
      
    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" />
    <!-- MetisMenu CSS -->
    <link rel="stylesheet" href="~/css/metisMenu.min.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="~/css/sb-admin-2.min.css">
    <!-- Custom Fonts -->
    <link rel="stylesheet" type="text/css" href="~/lib/font-awesome/css/font-awesome.min.css">

    <link href="~/lib/css-loader/dist/css-loader.css" rel="stylesheet" />
    <!-- Custom CSS -->
    @*<link rel="stylesheet" href="~/css/purple-skin.css">*@

    <!-- jQuery -->
    <script src="~/lib/jquery/jquery.min.js"></script>
    <script src="~/lib/jquery-serializeObject/jquery.serializeObject.min.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="~/lib/bootstrap/js/bootstrap.min.js"></script>

    <link href="~/css/ncc-common.css" rel="stylesheet" />
    <script src="~/js/ncc-common.js" asp-append-version="true"></script>
    <script src="~/lib/notifyjs/notify.min.js"></script>

    @* NEED TO CHECK WHAT IS THIS *@
    @*@Html.Raw(JavaScriptSnippet.FullScript)*@


    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    @RenderSection("Styles", required: false)
</head>

<body>
    <div id="loadingMask" class="loader loader-double"></div>
    @{ 
        var globalMessageContainer = "";
        var content = ThemeHelper.GetGlobalMessages(GlobalMessage.MessageFor.Admin);
        if (string.IsNullOrEmpty(content) == false)
        {
            globalMessageContainer = "<div id=\"globalMessageContainer\" class=\"ncc-global-message\">" + content + "</div>";
        }
    }
    <div id="wrapper">
        <div class="row">
            <div id="messageContainer">
                @if (TempData.ContainsKey("SuccessMessage") || ViewBag.SuccessMessage != null || ViewData["SuccessMessage"] != null)
                {
                    <div class="alert alert-success alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        @Html.Raw(TempData["SuccessMessage"])@Html.Raw(ViewBag.SuccessMessage)
                    </div>
                }
                @if (TempData.ContainsKey("InfoMessage") || ViewBag.InfoMessage != null || ViewData["InfoMessage"] != null)
                {
                    <div class="alert alert-info alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        @Html.Raw(TempData["InfoMessage"])@Html.Raw(ViewBag.InfoMessage)
                    </div>
                }
                @if (TempData.ContainsKey("WarningMessage") || ViewBag.WarningMessage != null || ViewData["WarningMessage"] != null)
                {
                    <div class="alert alert-warning alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        @Html.Raw(TempData["WarningMessage"])@Html.Raw(ViewBag.WarningMessage)
                    </div>
                }
                @if (TempData.ContainsKey("ErrorMessage") || ViewBag.ErrorMessage != null || ViewData["ErrorMessage"] != null)
                {
                    <div class="alert alert-danger alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                        @Html.Raw(TempData["ErrorMessage"])@Html.Raw(ViewBag.ErrorMessage)
                    </div>
                }
            </div>
        </div>
        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                @*<a class="navbar-brand" href="index.html">SB Admin v2.0</a>*@
                <a asp-area="" asp-controller="Admin" asp-action="Index" class="navbar-brand">@GlobalContext.WebSite.Name Admin</a>
            </div>
            <!-- /.navbar-header -->
            <ul class="nav navbar-top-links navbar-right">              
                @*<li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li>
                            <a href="#"><i class="fa fa-user fa-fw"></i> User Profile</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="login.html"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
                        </li>
                    </ul>
                    <!-- /.dropdown-user -->
                </li>*@
                <!-- /.dropdown -->
                @await Html.PartialAsync("_AdminLoginPartial")
            </ul>
            <!-- /.navbar-top-links -->
            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse">
                    <ul class="nav" id="side-menu">
                        @*<li class="sidebar-search">
                            <div class="input-group custom-search-form">
                                <input type="text" class="form-control" placeholder="Search...">
                                <span class="input-group-btn">
                                    <button class="btn btn-default" type="button">
                                        <i class="fa fa-search"></i>
                                    </button>
                                </span>
                            </div>
                            <!-- /input-group -->
                        </li>*@
                        <li class="active">
                            <a asp-controller="Dashboard" asp-action="Index"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
                        </li>                       
                        @Html.Raw(NccMenuHelper.GetAdminMenuHtml(NccMenuHelper.GetModulesAdminMenus(), User.GetUserId()))
                    </ul>
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>
        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="row">
                        <div class="row">
                            <div class="row">
                                <div class="row">
                                    @Html.Raw(globalMessageContainer)
                                </div>
                            </div>                            
                            @*<div id="globalMessageContainer" class="ncc-global-message">
                            </div>*@                            
                        </div>
                        <h2 class="page-header" style="margin-top:20px;">@Title</h2> 
                        @RenderBody()
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->
    </div>
    <div style="clear:both;"></div>
    <div class="row text-center">
        <hr />
        <footer>
            <p class="text-muted text-center">Developed by <a href="@NccInfo.Website" title="@NccInfo.Author" target="_blank">@NccInfo.Author</a>.</p>
        </footer>
    </div>
    <!-- /#wrapper -->
    
    <!-- Metis Menu Plugin JavaScript -->
    <script src="~/js/metisMenu.min.js"></script>
    <!-- Custom Theme JavaScript -->
    <script src="~/js/sb-admin-2.min.js"></script>

    <!--Bootstrap DateTime Picker Start-->
    <script src="~/lib/moment/moment.js"></script>
    <link href="~/lib/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <script src="~/lib/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('.datetimepicker').datetimepicker({
                format: 'MMM D, YYYY hh:mm A'
            });
        });
    </script>
    <!--Bootstrap DateTime Picker END-->
    @RenderSection("Scripts", required: false)
    <script>
        $(document).ready(function () {
            $.notify.defaults({
                "globalPosition": "top center"
            });

            var isMenuActive = false;
            $('.sidebar-nav').find('a').each(function () {
                @*var pathname = decodeURI(window.location.pathname);
                var pathnameLang = "/@CurrentLanguage" + pathname;

                if ($(this).attr('href') == pathname || $(this).attr('href') == pathnameLang) {
                    //$(this).addClass('active');
                    isMenuActive = true;
                }*@
                if ($(this).hasClass('active')) {
                    isMenuActive = true;
                }
                //console.log($(this).attr('href'));
                //console.log(pathname);
                //console.log(pathnameLang);
                //console.log(pathname);
            });

            if (isMenuActive == false) {
                var pathname = decodeURI(window.location.pathname);
                if (pathname == "/Dashboard" || pathname == "/@CurrentLanguage/Dashboard") {
                    $('.sidebar-nav').find('a').each(function () {
                        if ($(this).attr('href') == "/Dashboard/Index" || $(this).attr('href') == "/@CurrentLanguage/Dashboard/Index") {
                            //$(this).parent("li").parent("ul").addClass('active collapse in');
                            $(this).addClass('active');
                            isMenuActive = true;
                            console.log($(this).attr('href'));
                        }
                    });
                }
            }

            //console.log(isMenuActive);
            if (isMenuActive == false) {
                $('.sidebar-nav').find('a').each(function () {
                    if ($(this).attr('href') == "/CmsTheme/Settings" || $(this).attr('href') == "/@CurrentLanguage/CmsTheme/Settings") {
                        $(this).parent("li").parent("ul").addClass('active collapse in');
                        $(this).addClass('active');
                    }
                });
            }
        });
    </script>
</body>
</html>